/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSky.generator.command;

import ru.jSky.interfaces.JSkyMod;
import ru.jSky.interfaces.Major;

/**
 *
 * @author Rakev
 */
public class CreationCommand<T extends Major> implements GenerationCommand<T> {

    private JSkyMod editingMod;
    private EdidGenerationByBaseStrategy edidGenerator;

    public CreationCommand(JSkyMod editingMod, EdidGenerationByBaseStrategy edidGenerator) {
        this.editingMod = editingMod;
        this.edidGenerator = edidGenerator;
    }

    @Override
    public T apply(T baseItem) {
        T genetatedItem = (T) editingMod.makeCopy(baseItem, edidGenerator.generate(baseItem));
        return genetatedItem;
    }
}
